package com.sx.zongzhi.presenter;

import com.sx.zongzhi.MyApplication;
import com.sx.zongzhi.bean.KeyPunishBean;
import com.sx.zongzhi.bean.KeyPunishSearchBean;
import com.sx.zongzhi.modle.ApiManager;
import com.sx.zongzhi.net.BaseCallBack;
import com.sx.zongzhi.net.BaseResult;
import com.sx.zongzhi.view.IKeyPunishView;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by XZY on 2017/11/30.
 *获取重点地区整治排查
 */
public class KeyPunishPest {

    private IKeyPunishView punishView;

    public KeyPunishPest(IKeyPunishView punishView) {
        this.punishView=punishView;
    }


    /**
     *
     * @param orgId 网格id
     * @param searchBean 重点地区整治排查查询对象
     * @param page 页码
     * @param rows 页码显示条数
     */
    public void getKeyPunishList(String path, String orgId, KeyPunishSearchBean searchBean, int page, int rows){
        Map<String,Object> map=new HashMap<>();
        map.put("sid", MyApplication.sid);
        map.put("orgId", orgId);
        if (searchBean!=null){
            map.put("enterpriseVo.securityKeyAreas",searchBean.getName());
            map.put("enterpriseVo.securityProblems.id", searchBean.getProblemsId());
            map.put("enterpriseVo.involvedType.id", searchBean.getTypeId());
            map.put("enterpriseVo.effectEvaluate.id", searchBean.getEvaluateId());
            map.put("enterpriseVo.relateArea", searchBean.getRelateArea());
            map.put("enterpriseVo.repairLeaderUnit", searchBean.getRepairLeaderUnit());
            map.put("enterpriseVo.repairPartakeUnit", searchBean.getRepairPartakeUnit());
            map.put("enterpriseVo.leaderUnitDirector", searchBean.getLeaderName());
            map.put("enterpriseVo.leaderUnitDirectorMobileNumber", searchBean.getLeaderPhone());
            map.put("enterpriseVo.leaderUnitDirectorTelephone", searchBean.getLeaderTelephone());
        }
        map.put("page", page);
        map.put("rows", rows);
        new ApiManager().getKeyPunishList(path,map, new BaseCallBack<BaseResult<KeyPunishBean>>() {
            @Override
            public void onSuccess(BaseResult<KeyPunishBean> response) {
                punishView.getKeyPunishList(response.getData());
            }
            @Override
            public void onFailures(String message) {
                punishView.showError(message);
            }
        });
    }

}
